package com.example.dllo.my36kr.ui.fragment.investtabfragment;

import android.util.Log;
import android.widget.ListView;

import com.example.dllo.my36kr.R;
import com.example.dllo.my36kr.model.InvestListBean;
import com.example.dllo.my36kr.net.SingleVolley;
import com.example.dllo.my36kr.net.VolleyResult;
import com.example.dllo.my36kr.tools.InvestUrls;
import com.example.dllo.my36kr.ui.adapter.InvestListAdapter;

import com.example.dllo.my36kr.ui.fragment.AbsBaseFragment;
import com.google.gson.Gson;


/**
 * 股权投资的募资中fragment
 * 股权投资界面的listview的解析  4个页面都
 * 一样 所以我用一个布局一个适配器和一个bean
 * Created by CPC_272 on 16/8/16.
 */
public class InvestRaiseFragment extends AbsBaseFragment implements VolleyResult {
    private ListView listView;
    private InvestListAdapter adapter;
    InvestListBean bean;
    String url= InvestUrls.investZhong;
    @Override
    protected int setLayout() {
        return R.layout.fragment_invest_item;
    }

    @Override
    protected void initView() {
      listView=byView(R.id.top_ls);
    }

    @Override
    protected void initData() {
        SingleVolley.getInstence(context).startRequest(url,this);
    }

    @Override
    public void success(String str, int type) {

    }

    @Override
    public void success(String str) {
        Gson gson=new Gson();
        bean=gson.fromJson(str,InvestListBean.class);
        adapter=new InvestListAdapter(getContext());
        adapter.setData(bean);

        listView.setAdapter(adapter);

    }

    @Override
    public void failure() {

    }
}
